import requests
from config import url, headers_web


class CourseCompletion:
    def __init__(self):
        self.url = url
        self.headers = headers_web

    @classmethod
    def get_course_complet(cls,url,headers,params):
        """
        @Summary:获取课程完成度接口
        @Description:课程建设使用
        :param url:
        :param headers:
        :param params:{
                        "courseIds":"", # 课程ids
                        "validCode":"" # 验证码（&signKey=123123)
                        }
        :return:obiect:{
                        "completion":"", # 完成度,number
                        "courseId":"" # 课程id,string
                        }
        """
        url = url + "/courseApi/v1/coursecompletion"
        r = requests.get(url=url,headers=headers,params=params)
        return r


    @classmethod
    def get_course_complet_detail(cls,url,headers,params):
        """
         @Summary:获取课程完成度详情
        @Description:课程建设使用
        :param url:
        :param headers:
        :param params:params:{
                        "courseIds":"", # 课程ids
                        "validCode":"" # 验证码（courseId={}&signKey=123123）
                        }
        :return:obiect:{
                        "contentTypeName":"", # 完成度类型名称,string
                        "contentTypeValue":"" # 完成度类型值,string
                        "isCompleted":"", # 是否完成,boolean
                        "showOrder":"", # 排序,integer
                        "typeParentName":"" # 类型父级名称,	string
                        }
        """
        url = url + "/courseApi/v1/coursecompletion/detail"
        r = requests.get(url=url, headers=headers, params=params)
        return r
